package com.yitiao.designmodel.create.prototype;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.io.Serializable;

@Data
@AllArgsConstructor
public class Yitiao implements Cloneable, Serializable {

    private String name;
    private Integer id;
    private String wechat;
    private Age age;

    public Yitiao(){
        System.out.println("Yitiao对象创建");
    }

    @Override
    protected Yitiao clone() throws CloneNotSupportedException {
//        Yitiao yitiao = new Yitiao();
//        yitiao.setName(name);
//        yitiao.setId(id);
//        yitiao.setWechat(wechat);
//        return yitiao;
        return (Yitiao) super.clone();
    }
    public Yitiao(Yitiao yitiao){
        id=yitiao.id;
        age=yitiao.age;
    }
}
